﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using PSE.Communication.Fix.Common.Fixml.Enum;

namespace PSE.Communication.Fix.Common.Fixml
{
    [XmlRoot("AllocInstrctn")]
    public class AllocationInstruction
    {
        [XmlAttribute("ID")]
        public int Id { get; set; }
        
        [XmlAttribute("TrdDt", DataType = "date")]
        public DateTime TradeDate { get; set; }
        
        [XmlIgnore]
        public Side Side { get; set; }
        
        [XmlAttribute("Side")]
        public int SideValue
        {
            get { return (int)Side; }
            set { Side = (Side)value; }
        }
        
        [XmlAttribute("RawData")]
        public string Token { get; set; }
        
        [XmlAttribute("RawDataLength")]
        public int TokenLength { get; set; }
        
        [XmlElement("Alloc", IsNullable = false)]
        public List<AllocationData> AllocationData { get; set; }
        
        [XmlElement("AllExc", IsNullable = false)]
        public AllocationExcecution AllocationExcecution { get; set; }
        
        [XmlElement("Pty", IsNullable = false)]
        public AllocationParty AllocationParty { get; set; }
        
        [XmlElement("Instrmt", IsNullable = false)]
        public AllocationInstrumet AllocationInstrumet { get; set; }
    }
}
